package xyhoo.springframework.core.io;

import xyhoo.springframework.util.Assert;

/**
 * 一个持有者，将{@link Resource}描述符与用于读取资源内容的特定编码或{@code Charset}组合在一起
 */
public class EncodedResource {

    private final Resource resource;

    private final String encoding;

    private final String charset;

    public EncodedResource(Resource resource) {
        this(resource, null, null);
    }

    private EncodedResource(Resource resource, String encoding, String charset) {
        super();
        Assert.notNull(resource, "Resource must not be null");
        this.resource = resource;
        this.encoding = encoding;
        this.charset = charset;
    }

    public final Resource getResource() {
        return this.resource;
    }

    public String getEncoding() {
        return encoding;
    }

    public String getCharset() {
        return charset;
    }
}
